package com.gnkexy.springframework.context.supper;

import com.gnkexy.springframework.beans.factory.ConfigurableListableBeanFactory;
import com.gnkexy.springframework.beans.factory.support.DefaultListableBeanFactory;

public abstract class AbstractRefreshableApplicationContext extends AbstractApplicationContext{

    private DefaultListableBeanFactory beanFactory;

    @Override
    protected void refreshBeanFactory() {
        DefaultListableBeanFactory beanFactory = creatBeanFactory();
        loadBeanDifinitions(beanFactory);
        this.beanFactory=beanFactory;

    }

    private DefaultListableBeanFactory creatBeanFactory() {
        return new DefaultListableBeanFactory();
    }

    protected abstract void loadBeanDifinitions(DefaultListableBeanFactory beanFactory);

    @Override
    protected ConfigurableListableBeanFactory getBeanFactory() {
        return beanFactory;
    }
}
